package net.pimpas.web.jsf.components.simpletag;

import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;

import net.pimpas.web.jsf.util.ComponentInformation;

public class UISimpleTag extends UIComponentBase {
	
	public static final String COMPONENT_TYPE			= ComponentInformation.COMPONENT_PREFIX_TYPE+".simpleTag";
	public static final String COMPONENT_FAMILY			= ComponentInformation.COMPONENT_PREFIX_FAMILY+".simpleTag";
	public static final String COMPONENT_RENDER_TYPE	= ComponentInformation.COMPONENT_PREFIX_RENDER+".simpleTag";
	
	private String tag;
	
	@Override
	public Object saveState(FacesContext arg0) {
		Object[] ob = new Object[2];
		ob[0] = super.saveState(arg0);
		ob[1] = this.getTag();
		
		return ob;
	}
	
	@Override
	public void restoreState(FacesContext arg0, Object arg1) {
		Object[] ob = (Object[]) arg1;
		super.restoreState(arg0, ob[0]);
		this.setTag((String) ob[1]);
	}
	
	@Override
	public boolean getRendersChildren() {
		return true;
	}
	
	@Override
	public String getFamily() {
		return COMPONENT_FAMILY;
	}

	@Override
	public String getRendererType() {
		return COMPONENT_RENDER_TYPE;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}
}